package chan.project.model.vo;

import cn.hutool.json.JSONUtil;
import chan.project.model.entity.TravelPlan;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 旅行计划视图
 *
 * @author <a href="https://github.com/kavansp">kavansp</a>
 * 
 */
@Data
public class TravelPlanVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 计划需求
     */
    private String planRequirements;

    /**
     * 计划生成路线
     */
    private String generatedRoute;

    /**
     * 计划生成描述
     */
    private String generatedDescription;

    /**
     * 创建用户信息
     */
    private UserVO user;

    /**
     * 点赞数
     */
    private Integer thumbNum;

    /**
     * 当前计划当前用户是否点赞
     */
    private Boolean isThumb;

    /**
     * 封装类转对象
     *
     * @param travelPlanVO
     * @return
     */
    public static TravelPlan voToObj(TravelPlanVO travelPlanVO) {
        if (travelPlanVO == null) {
            return null;
        }
        TravelPlan travelPlan = new TravelPlan();
        BeanUtils.copyProperties(travelPlanVO, travelPlan);
        return travelPlan;
    }

    /**
     * 对象转封装类
     *
     * @param travelPlan
     * @return
     */
    public static TravelPlanVO objToVo(TravelPlan travelPlan) {
        if (travelPlan == null) {
            return null;
        }
        TravelPlanVO travelPlanVO = new TravelPlanVO();
        BeanUtils.copyProperties(travelPlan, travelPlanVO);
        return travelPlanVO;
    }
}
